33c4a4830cdfbf0afb549ddee97da580d21396dd,trunk/JLanguageTool/src/main/java/org/languagetool/tools/StringTools.java,StringTools,ruleMatchesToXML,#List#String#number#XmlPrintMode#Language#Language#,332
Before Change
xml.append(subId);
xml.append(" msg=\"" + escapeXMLForAPIOutput(msg) + "\"");
String context = contextTools.getContext(match.getFromPos(), match.getToPos(), text);
xml.append(" replacements=\""
+ escapeXMLForAPIOutput(listToString(
match.getSuggestedReplacements(), "#")) + "\"");
// get position of error in context and remove artificial marker again:
final int contextOffset = context.indexOf(START_MARKER);
context = context.replaceFirst(START_MARKER, "");
context = context.replaceAll("[\n\r]", " ");
xml.append(" context=\"" + StringTools.escapeXML(context) + "\"");
xml.append(" contextoffset=\"" + contextOffset + "\"");
xml.append(" offset=\"" + match.getFromPos() + "\"");
xml.append(" errorlength=\"" + (match.getToPos() - match.getFromPos()) + "\"");
if (match.getRule().getUrl() != null) {
xml.append(" url=\""
+ escapeXMLForAPIOutput(match.getRule().getUrl().toString())
+ "\"");
}
final Category category = match.getRule().getCategory();
if (category != null) {
After Change
xml.append(subId);
xml.append(" msg=\"").append(escapeXMLForAPIOutput(msg)).append("\"");
String context = contextTools.getContext(match.getFromPos(), match.getToPos(), text);
xml.append(" replacements=\"").append(escapeXMLForAPIOutput(listToString(
match.getSuggestedReplacements(), "#"))).append("\"");
// get position of error in context and remove artificial marker again:
final int contextOffset = context.indexOf(START_MARKER);
context = context.replaceFirst(START_MARKER, "");
context = context.replaceAll("[\n\r]", " ");
xml.append(" context=\"").append(StringTools.escapeXML(context)).append("\"")
.append(" contextoffset=\"").append(contextOffset).append("\"")
.append(" offset=\"").append(match.getFromPos()).append("\"")
.append(" errorlength=\"").append(match.getToPos() - match.getFromPos()).append("\"");
if (match.getRule().getUrl() != null) {
xml.append(" url=\"").append(escapeXMLForAPIOutput(match.getRule().getUrl().toString())).append("\"");
}
final Category category = match.getRule().getCategory();
if (category != null) {